$(function (){
	$("#login").click(login);
	$('#reg').click(reg);
});

function login(){
	var url = baseUrl + "/index.php?a=dologin";
	
	var data = {};
	data.username = $('#username').val();
	data.password = $('#password').val();
	
	$.post(url, data, function (result){
		if (result.status == 0){
			alert(result.message);
		}else{
			location.href= baseUrl + "/index.php?a=bet";
		}
	}, "json");
}

function reg(){
	var url = baseUrl + "/index.php?a=doreg";
	var data = {};
	data.username = $('#username').val();
	data.password = $('#password').val();
	
	$.post(url, data, function (result){
		if (result.status == 0){
			alert(result.message);
		}else{
			location.href= baseUrl + "/index.php?a=bet";
		}
	}, "json");
}